﻿using System;
using System.Windows.Input;
using JulMar.Silverlight.Mvvm;

namespace MediaBrowserSL.RIA.ViewModels
{
    /// <summary>
    /// View Model Base
    /// </summary>
    public class ViewModelBase : ViewModel
    {
        public ICommand CloseCommand
        {
            get;
            private set;
        }

        public ViewModelBase()
        {
            CloseCommand = new DelegatingCommand(OnRequestClose);
            //Init Mediator
            RegisterWithMessageMediator();
        }

        #region RequestClose [event]

        public event EventHandler RequestClose;

        void OnRequestClose()
        {
            EventHandler handler = this.RequestClose;
            if (handler != null)
                handler(this, EventArgs.Empty);
        }

        #endregion RequestClose [event]
    }
}
